import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
import Layout from '@/layout' //页面整体布局
/**
 * constantRoutes
 *没有权限要求的页面
 *可以访问所有角色
 */
export const constantRoutes = [{
		path: '/redirect',
		component: Layout,
		meta: {
			title: '重定向',
		},
		hidden: true, //不需要显示在侧边导航
		children: [{
			path: '/redirect/:path(.*)',
			component: () => import('@/views/redirect/index')
		}],
	},
	{
		path: '/Login',
		name: "Login",
		meta: {
			title: "登录"
		},
		hidden: true,
		component: () => import('@/views/Login/Login')
	},
	{
		path: '/Register',
		name: "Register",
		meta: {
			title: "注册"
		},
		hidden: true,
		component: () => import('@/views/Register/Register')
	},
	{
		path: '/',
		component: Layout,
		redirect: '/Home',
		children: [{
			path: '/Home',
			name: 'Home',
			meta: {
				title: '首页',
				icon: 'el-icon-s-home'
			},
			isTopDirectory: true, //是否作为上级目录
			component: () => import('@/views/Home/Home')
		}]
	}
]
/**
 *异步路由
 *需要根据用户角色动态加载的路由
 */
export const asyncRoutes = [{
		path: '/MasterDataManagement',
		name: 'MasterDataManagement',
		redirect: '/CustomerInfo',
		meta: {
			title: '主数据管理',
			icon: 'el-icon-s-platform'
		},
		component: Layout,
		children: [{
				path: '/CustomerInfo',
				name: 'CustomerInfo',
				meta: {
					title: '客户主档',
					icon: 'el-icon-s-order'
				},
				component: () => import('@/views/MasterDataManagement/CustomerInfo/CustomerInfo')
			},
			{
				path: '/SupplierInfo',
				name: 'SupplierInfo',
				meta: {
					title: '供应商主档',
					icon: 'el-icon-s-order'
				},
				component: () => import('@/views/MasterDataManagement/SupplierInfo/SupplierInfo')
			},
			{
				path: '/MaterielInfo',
				name: 'MaterielInfo',
				meta: {
					title: '商品主档',
					icon: 'el-icon-s-order'
				},
				component: () => import('@/views/MasterDataManagement/MaterielInfo/MaterielInfo')
			}
		]
	},
	{
		path: '/UnitPriceManagement',
		name: 'UnitPriceManagement',
		redirect: '/PurchaseQuotation',
		meta: {
			title: '单价管理',
			icon: 'el-icon-s-platform'
		},
		component: Layout,
		children: [{
				path: '/PurchaseQuotation',
				name: 'PurchaseQuotation',
				meta: {
					title: '采购报价单',
					icon: 'el-icon-s-order'
				},
				component: () => import('@/views/UnitPriceManagement/PurchaseQuotation/PurchaseQuotation')
			},
			{
				path: '/PurchasePriceManagement',
				name: 'PurchasePriceManagement',
				meta: {
					title: '采购单价管理',
					icon: 'el-icon-s-order'
				},
				component: () => import(
					'@/views/UnitPriceManagement/PurchasePriceManagement/PurchasePriceManagement')
			},
			{
				path: '/PurchasePriceQuery',
				name: 'PurchasePriceQuery',
				meta: {
					title: '采购单价查询',
					icon: 'el-icon-s-order'
				},
				component: () => import('@/views/UnitPriceManagement/PurchasePriceQuery/PurchasePriceQuery')
			},
			{
				path: '/SalesQuotation',
				name: 'SalesQuotation',
				meta: {
					title: '销售报价单',
					icon: 'el-icon-s-order'
				},
				component: () => import('@/views/UnitPriceManagement/SalesQuotation/SalesQuotation')
			},
			{
				path: '/SalesPriceMaintenance',
				name: 'SalesPriceMaintenance',
				meta: {
					title: '销售单价维护',
					icon: 'el-icon-s-order'
				},
				component: () => import('@/views/UnitPriceManagement/SalesPriceMaintenance/SalesPriceMaintenance')
			}
		]
	},
	{
		path: '/DemandPlanning',
		name: 'DemandPlanning',
		redirect: '/PurchaseRequest',
		meta: {
			title: '需求计划',
			icon: 'el-icon-s-platform'
		},
		component: Layout,
		children: [{
				path: '/PurchaseRequest',
				name: 'PurchaseRequest',
				meta: {
					title: '采购报申请',
					icon: 'el-icon-s-order'
				},
				component: () => import('@/views/DemandPlanning/PurchaseRequest/PurchaseRequest')
			}
		]
	},
	{
		path: '/PurchasingManagement',
		name: 'PurchasingManagement',
		redirect: '/PurchasingOrder',
		meta: {
			title: '采购管理',
			icon: 'el-icon-s-platform'
		},
		component: Layout,
		children: [{
			path: '/PurchasingOrder',
			name: 'PurchasingOrder',
			meta: {
				title: '采购订单',
				icon: 'el-icon-s-order'
			},
			component: () => import('@/views/PurchasingManagement/PurchasingOrder/PurchasingOrder')
		}]
	},
	{
		path: '/SystemManagement',
		name: 'SystemManagement',
		redirect: '/MenuManagement',
		meta: {
			title: '系统管理',
			icon: 'el-icon-s-platform'
		},
		component: Layout,
		children: [{
			path: '/MenuManagement',
			name: 'MenuManagement',
			meta: {
				title: '菜单管理',
				icon: 'el-icon-s-order'
			},
			component: () => import('@/views/SystemManagement/MenuManagement/MenuManagement')
		},
		{
			path: '/UserManagement',
			name: 'UserManagement',
			meta: {
				title: '用户管理',
				icon: 'el-icon-s-order'
			},
			component: () => import('@/views/SystemManagement/UserManagement/UserManagement')
		},{
			path: '/RoleManagement',
			name: 'RoleManagement',
			meta: {
				title: '角色管理',
				icon: 'el-icon-s-order'
			},
			component: () => import('@/views/SystemManagement/RoleManagement/RoleManagement')
		}],
	},
	{
		path: '/DictionaryManagement',
		name: 'DictionaryManagement',
		redirect: '/TaxRate',
		meta: {
			title: '字典管理',
			icon: 'el-icon-s-platform'
		},
		component: Layout,
		children: [{
			path: '/TaxRate',
			name: 'TaxRate',
			meta: {
				title: '税率管理',
				icon: 'el-icon-s-order'
			},
			component: () => import('@/views/DictionaryManagement/TaxRate/TaxRate')
		},
		{
			path: '/DistributionChannel',
			name: 'DistributionChannel',
			meta: {
				title: '分销渠道',
				icon: 'el-icon-s-order'
			},
			component: () => import('@/views/DictionaryManagement/DistributionChannel/DistributionChannel')
		},
		{
			path: '/InoutType',
			name: 'InoutType',
			meta: {
				title: '出入库类型',
				icon: 'el-icon-s-order'
			},
			component: () => import('@/views/DictionaryManagement/InoutType/InoutType')
		},
		{
			path: '/SettlementMethod',
			name: 'SettlementMethod',
			meta: {
				title: '结算方式',
				icon: 'el-icon-s-order'
			},
			component: () => import('@/views/DictionaryManagement/SettlementMethod/SettlementMethod')
		},
		{
			path: '/PaymentMethod',
			name: 'PaymentMethod',
			meta: {
				title: '付款方式',
				icon: 'el-icon-s-order'
			},
			component: () => import('@/views/DictionaryManagement/PaymentMethod/PaymentMethod')
		},
		{
			path: '/DocumentFormat',
			name: 'DocumentFormat',
			meta: {
				title: '单据格式',
				icon: 'el-icon-s-order'
			},
			component: () => import('@/views/DictionaryManagement/DocumentFormat/DocumentFormat')
		},
		{
			path: '/CommodityClassification',
			name: 'CommodityClassification',
			meta: {
				title: '商品分类',
				icon: 'el-icon-s-order'
			},
			component: () => import('@/views/DictionaryManagement/CommodityClassification/CommodityClassification')
		},
		{
			path: '/UnitMeasurement',
			name: 'UnitMeasurement',
			meta: {
				title: '计量单位',
				icon: 'el-icon-s-order'
			},
			component: () => import('@/views/DictionaryManagement/UnitMeasurement/UnitMeasurement')
		},
		{
			path: '/TypeManagement',
			name: 'TypeManagement',
			meta: {
				title: '类型管理',
				icon: 'el-icon-s-order'
			},
			component: () => import('@/views/DictionaryManagement/TypeManagement/TypeManagement')
		},
		{
			path: '/Currency',
			name: 'Currency',
			meta: {
				title: '币别',
				icon: 'el-icon-s-order'
			},
			component: () => import('@/views/DictionaryManagement/Currency/Currency')
		},
		{
			path: '/LocationCode',
			name: 'LocationCode',
			meta: {
				title: '地点代码',
				icon: 'el-icon-s-order'
			},
			component: () => import('@/views/DictionaryManagement/LocationCode/LocationCode')
		},
		{
			path: '/CompanyCode',
			name: 'CompanyCode',
			meta: {
				title: '公司代码',
				icon: 'el-icon-s-order'
			},
			component: () => import('@/views/DictionaryManagement/CompanyCode/CompanyCode')
		},
		{
			path: '/stockCode',
			name: 'stockCode',
			meta: {
				title: '库存代码',
				icon: 'el-icon-s-order'
			},
			component: () => import('@/views/DictionaryManagement/stockCode/stockCode')
		}],
		
		
		
		
		
	}

]
// const routes = constantRoutes.concat(asyncRoutes)
const routes = constantRoutes
const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes
})

export default router
